package ink.ykb.demo.permission.enums;

/**
 * 权限类型，0：接口权限，1:菜单权限
 * 
 * @author mading
 *
 */
public enum RuleType {

	/** 0：接口权限 */
	ACCESS("access", 0),

	/** 1：菜单权限 */
	MENU("menu", 1);

	private String name;

	private Integer value;

	private RuleType(String name, Integer value) {
		this.name = name;
		this.value = value;
	}

	public static RuleType getType(Integer value) {
		if (value == null) {
			return null;
		}
		RuleType[] values = RuleType.values();
		for (RuleType type : values) {
			if (type.getValue().equals(value)) {
				return type;
			}
		}
		return null;
	}

	public String getName() {
		return name;
	}

	public Integer getValue() {
		return value;
	}

}
